/api/user/folders/[id]
Info
Requires authentication
Parameters
Field Name | Type | Description |
---|---|---|
id | number | Folder ID |
GET Get a folder
Query
Field Name | Type | Description |
---|---|---|
files | boolean | Whether to include the files in the response. |
200 Ok (JSON)
Returns a folder
{"id": 1,"name": "test","userId": 1,"createdAt": "2023-01-28T18:56:55.363Z","updatedAt": "2023-01-28T18:56:55.363Z"}
If ?files=true
:
{"files": [{"id": 37,"name": "NhOHti.png","originalName": null,"mimetype": "image/png","createdAt": "2023-01-14T21:32:35.097Z","expiresAt": null,"maxViews": null,"views": 0,"favorite": false,"embed": true,"format": "RANDOM","userId": 1,"folderId": 1,"url": "/NhOHti.png"},...],"id": 1,"name": "test","userId": 1,"createdAt": "2023-01-28T18:56:55.363Z","updatedAt": "2023-01-28T18:56:55.363Z"}
404 Not Found
folder not found
- Folder not found
403 Forbidden
you do not have permission to access this folder
- You do not have permission to access this folder I guess.
POST Add a file to a folder
Query
Field Name | Type | Description |
---|---|---|
files | boolean | Whether to include the files in the response. |
Body (JSON)
Field Name | Type | Description |
---|---|---|
file | `number | string` |
200 Ok (JSON)
Returns same as Get a folder
400 Bad Request
file is required
- There was nofile
property within the JSON bodyfile must be a number
- Thefile
property must be resolvable to a number.file is already in folder
- The file is already in the folder.
404 Not Found
file not found
- File not foundfolder not found
- Folder not found
403 Forbidden
you do not have permission to access this file
- You can't add another user's file to your folder.you do not have permission to access this folder
- You can't add a file to another user's folder.
DELETE Remove a file from a folder or delete a folder
Query
Field Name | Type | Description |
---|---|---|
files | boolean | Whether to include the files in the response. |
Body (JSON)
Field Name | Type | Description |
---|---|---|
deletingFolder | boolean | Whether to delete the folder or not. If this value is present and true , it will delete the folder. If it is false or not present it will delete a file with the below options |
file | `number | string` |
200 Ok (JSON) (deleting a file)
Returns same as Get a folder
200 Ok (JSON) (deleting a folder)
Returns the folder that was deleted
{"id": 1,"name": "test","userId": 1,"createdAt": "2023-01-28T18:56:55.363Z","updatedAt": "2023-01-28T18:56:55.363Z"}
400 Bad Request
id must be a number
- Theid
parameter must be resolvable to a number.file is required
- There was nofile
property within the JSON bodyfile must be a number
- Thefile
property must be resolvable to a number.file is not in folder
- The file is not in the folder.
404 Not Found
file not found
- File not foundfolder not found
- Folder not found
403 Forbidden
you do not have permission to access this file
- You can't remove another user's file from your folder.you do not have permission to access this folder
- You can't remove a file from another user's folder.
Last updated: 5/13/2023
Edit this page on GitHub